package model;

final public class PortEntry {

	private final int portNumber;
	private final String service;
	private PortProtocol type;
	public PortEntry(int portNumber, String protocol, String service){
		this.portNumber = portNumber;
		this.service = service;
		
		if (protocol.equals("udp")){
			type = PortProtocol.UDP;
		}
		type =  PortProtocol.TCP;
	}
	public String getService(){
		return service;
	}
	public int getPortNumber (){
		return portNumber;
	}
	public PortProtocol getPortProcol(){
		return type;
	}
	public enum PortProtocol{
		TCP("tcp"),
		UDP("udp");
		
		private String protocol;
		PortProtocol(String protocol){
			this.protocol = protocol;
		}
		
		String getProtcolString(){
			return protocol;
		}
	}
	public boolean PortEntryEquals(PortEntry arg){
		//determines whether a port entry is equal to another, based on port number and service
		if (arg.getPortNumber()==portNumber && arg.getService().equals(service)){
			return true;
		}
		return false;
	}
	
}
